<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<ul id="ul2">
  <li>123</li>
  <li>1234</li>
  <li>1235</li>
  <li>1237</li>
</ul>
<script>
  window.onload = function () {
    var ul1 = document.getElementById("ul2");
    ul1.onclick = function (ev) {
      var ev = ev || window.event;
      var target = ev.target || ev.srcElement;
      if(target.nodeName.toLowerCase() == 'li'){
        alert(target.innerHTML);
      }

    }

  }
</script>

</body>
</html>